/* 本地缓存数据，每次调用修改时会重新更新本地缓存 */

const storageMap = {
  token: ''
}

/* 从本地缓存取 */
for (const key in storageMap) {
  storageMap[ key ] = uni.getStorageSync(key)
}

export default {
  state: () => {
    return { ...storageMap }
  },
  mutations: {
    setToken(state, val) {
      state.token = val
      uni.setStorageSync('token', val)
    }
  },
}
